package cn.iocoder.yudao.framework.common.enums;

import cn.iocoder.yudao.framework.common.core.ArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * 交易时间模块枚举
 *
 * @author admin
 */
@Getter
@AllArgsConstructor
public enum TradingModuleEnum implements ArrayValuable<Integer> {

    FULL_PAYMENT(0, "全款"),
    LOCK_PRICE(1, "锁价"),
    REGULAR(2, "常规"),
    ;

    public static final Integer[] ARRAYS = Arrays.stream(values()).map(TradingModuleEnum::getType).toArray(Integer[]::new);

    /**
     * 类型值
     */
    private final Integer type;
    /**
     * 类型名
     */
    private final String name;

    @Override
    public Integer[] array() {
        return ARRAYS;
    }

    public static boolean isFullPayment(Integer type) {
        return FULL_PAYMENT.type.equals(type);
    }

    public static boolean isLockPrice(Integer type) {
        return LOCK_PRICE.type.equals(type);
    }

    public static boolean isRegular(Integer type) {
        return REGULAR.type.equals(type);
    }
} 